function v = fillvel(mt, mv, t)
if length(mt) == 1
    v = ones(size(t))*mv;
else
    v = interp1(mt, mv, t, 'linear');
%     v = zeros(size(t));
%     for i=length(mt):-1:1
%         v(t<mt(i))=mv(i);
%     end
end
v(t<mt(1)) = mv(1);
v(t>mt(end)) = mv(end);
end